package com.ego.product.po;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import com.ego.product.vo.spu.Image;
import lombok.Data;

/**
 * @program: ego
 * @description sku图片
 * @author KamTang
 * @date 2022-11-13 12:56:14
 */
@Data
@TableName("pms_sku_image")
public class SkuImage implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * id
	 */
	@TableId
	private Long id;
	/**
	 * sku_id
	 */
	private Long skuId;
	/**
	 * 图片地址
	 */
	private String imgUrl;
	/**
	 * 排序
	 */
	private Integer imgSort;
	/**
	 * 默认图[0 - 不是默认图，1 - 是默认图]
	 */
	private Integer defaultImg;

	public static SkuImage build(Long skuId, Image image) {
		SkuImage entity = new SkuImage();
		entity.setSkuId(skuId);
		entity.setImgUrl(image.getImgUrl());
		entity.setDefaultImg(image.getDefaultImg());
		return entity;
	}
}
